%%% -------------------------------------------------------------------
%%%
%%% http://www.9miao.com
%%% -------------------------------------------------------------------
-module(dragon_fight_sup).

-behaviour(supervisor).
%% --------------------------------------------------------------------
%% Include files
%% --------------------------------------------------------------------

%% --------------------------------------------------------------------
%% External exports
%% --------------------------------------------------------------------
-export([start_link/0,start_child/1,stop_child/0]).

%% --------------------------------------------------------------------
%% Internal exports
%% --------------------------------------------------------------------
-export([
	 init/1
        ]).

%% --------------------------------------------------------------------
%% Macros
%% --------------------------------------------------------------------
-define(SERVER, ?MODULE).

%% --------------------------------------------------------------------
%% Records
%% --------------------------------------------------------------------

%% ====================================================================
%% External functions
%% ====================================================================
start_link()->
	supervisor:start_link({local,?MODULE}, ?MODULE, []).


%% ====================================================================
%% Server functions
%% ====================================================================
%% --------------------------------------------------------------------
%% Func: init/1
%% Returns: {ok,  {SupFlags,  [ChildSpec]}} |
%%          ignore                          |
%%          {error, Reason}
%% --------------------------------------------------------------------
%%AChild = {activity_manager,{activity_manager,start_link,[]},
%%	      permanent,2000,worker,[activity_manager]},
init([]) ->
    {ok,{{one_for_one,10,10}, []}}.

start_child(Info)->	
	try
		AChild = {dragon_fight_processor ,{dragon_fight_processor,start_link,[Info]},
				  	      		temporary,2000,worker,[dragon_fight_processor]},
		supervisor:start_child(?MODULE, AChild)
	catch
		E:R:_Stacktrace-> io:format("can not start dragon_fight_processor(~p:~p)~n",[E,R]),
			  {error,R}
 	end.

stop_child()->
	supervisor:terminate_child(?MODULE, dragon_fight_processor),
	supervisor:delete_child(?MODULE, dragon_fight_processor).
%% ====================================================================
%% Internal functions
%% ====================================================================
	

	
	
